home *** CD-ROM | disk | FTP | other *** search
- #include <AppleEvents.h>
- //enum {
- // uppMainEntryProcInfo = kPascalStackBased
- // | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
- // | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AppleEvent *)))
- // | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent *)))
- // | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *)))
- //};
- //
- ////This is necessary for an accelerated resource (if it were one)
- //ProcInfoType __procinfo = uppMainEntryProcInfo;
-
- pascal OSErr main( AppleEvent *theAEEvent, AppleEvent *theReply, long *theRefCon)
- {
- OSErr theErr = noErr;
- Boolean result = false;
- AEEventHandlerUPP JunkA;
- long JunkB;
- unsigned char tempstring[8]="mongfrag";
- AEKeyword AEClass;
- AEKeyword inType;
- AEKeyword AEid;
- Size theMaxSize,theSize=8;
-
- if ( theReply->dataHandle != NULL )
- {
- theMaxSize=8;
-
- theErr = AEGetParamPtr (theAEEvent,keyDirectObject,typeChar,&inType,(Ptr)&tempstring,theMaxSize,&theSize);
-
- if (theErr) return theErr;
- if ((theSize !=8)&&(theSize!=4)) theErr=errAEEventNotHandled;
- if (!theErr)
- {
- if (theSize == 4)
- AEid='xist';
- else
- AEid=(long)tempstring[4]*256*65536+(long)tempstring[5]*65536+(long)tempstring[6]*256+(long)tempstring[7];
-
- AEClass=(long)tempstring[0]*256*65536+(long)tempstring[1]*65536+(long)tempstring[2]*256+(long)tempstring[3];
-
- if (noErr==AEGetEventHandler (AEClass,AEid,&JunkA,&JunkB,true))
- result=true;
- else
- result=false;
- theErr = AEPutParamPtr(theReply, keyDirectObject, typeBoolean,
- &result, sizeof(result));
-
- }
- }
- else
- theErr = errAEEventNotHandled;
-
- return theErr;
-
- }
-